<gm:page title="My App" authenticate="false">
 
<h1>Places</h1> 

<gm:list id="placesFeed" data="http://www.google.com/base/feeds/snippets/-/hike%20reviews" pagesize="10" template="placesTemplate">
  <gm:handleEvent event="select" execute="changeImgData(event.entry);"/>
</gm:list>

<gm:data id="postsFeed" data="http://www.blogger.com/feeds/7922314938693025385/posts/default/"/>

<gm:list id="postsList" data="${postsFeed}" template="nullTemplate"/>
<h2> Post </h2>
<gm:item id="postItem" template="postTemplate"/>

<h2>Comentarios</h2>
<gm:list id="commentsList" template="blog">
</gm:list>
   
<!-- templates -->
<gm:template id="placesTemplate">
    <table>
      <tr repeat="true">
        <td><gm:text ref="atom:title"/></td>
        <td><gm:text ref="atom:content"/></td>
      </tr>
    </table>
</gm:template>

<gm:template id="postTemplate">
    <table>
      <tr>
        <td><gm:html ref="atom:content"/></td>
      </tr>
    </table>
</gm:template> 

<gm:template id="nullTemplate">
  <span repeat="true"></span>
</gm:template> 

  
<script>
  gd:entryLink/entry/gd:rating/@value
  
    function changeImgData(entry) {
      if (entry) {
        var urlGPath = new GPath("g:post_link");  
        var urlString = urlGPath.getValue(entry);
 
        //alert(urlString);
        var myListData = google.mashups.getObjectById('postsFeed');
        var myItem = google.mashups.getObjectById('postItem');  
        var postLinkGPath = new GPath("atom:link[@rel='alternate']/@href");
        var i=0;
        //alert(myListData.size());

        // Get Post Content
        for (i = 0; i < myListData.size(); i++) {
          postEntry = myListData.entryAt(i);
          var postLink = postLinkGPath.getValue(postEntry);
          if (urlString == postLink ) {
             myItem.setEntry(postEntry);
             break;
          }
        }
  
        //commentsList
        myListData = google.mashups.getObjectById('commentsList');
        urlGPath = new GPath("g:comments_link");  
        urlString = urlGPath.getValue(entry);
        if (urlString)
          myListData.setData(urlString)
        else {
          myListData.setData(null);
        }
        
      } else {
        //google.mashups.getObjectById('postItem').setEntry(null);
      }

    };


  </script>  



</gm:page>  
  


